package org.vt.ece3574.pictoslider.facebook;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;

import com.facebook.android.AsyncFacebookRunner.RequestListener;
import com.facebook.android.FacebookError;

/**
 * Listener object for facebook requests.
 * 
 * @author Michael
 */
public class FacebookRequestListener implements RequestListener {

	/**
	 * The FacebookManager object for this listener.
	 */
	private FacebookManager fbManager;

	/**
	 * The constructor for this class.
	 * 
	 * @param f
	 *            - The FacebookManager for this listener.
	 */
	public FacebookRequestListener(FacebookManager f) {
		fbManager = f;
	}

	/* (non-Javadoc)
	 * @see com.facebook.android.AsyncFacebookRunner.RequestListener#onComplete(java.lang.String, java.lang.Object)
	 */
	public void onComplete(String response, Object state) {
		fbManager.notifyPostComplete();
	}

	/* (non-Javadoc)
	 * @see com.facebook.android.AsyncFacebookRunner.RequestListener#onIOException(java.io.IOException, java.lang.Object)
	 */
	public void onIOException(IOException e, Object state) {
		e.printStackTrace();
	}

	/* (non-Javadoc)
	 * @see com.facebook.android.AsyncFacebookRunner.RequestListener#onFileNotFoundException(java.io.FileNotFoundException, java.lang.Object)
	 */
	public void onFileNotFoundException(FileNotFoundException e, Object state) {
		e.printStackTrace();
	}

	/* (non-Javadoc)
	 * @see com.facebook.android.AsyncFacebookRunner.RequestListener#onMalformedURLException(java.net.MalformedURLException, java.lang.Object)
	 */
	public void onMalformedURLException(MalformedURLException e, Object state) {
		e.printStackTrace();
	}

	/* (non-Javadoc)
	 * @see com.facebook.android.AsyncFacebookRunner.RequestListener#onFacebookError(com.facebook.android.FacebookError, java.lang.Object)
	 */
	public void onFacebookError(FacebookError e, Object state) {
		e.printStackTrace();
	}

}
